#ifndef _RETRO_HIERARCHY
#define _RETRO_HIERARCHY

#define RETRO_NESTEDPATHLENGTH    500

#define RETRO_HIERARCHY_EXPANDED  0x00000010

namespace Retro
{
  namespace Creator
  {
    struct HierarchyHeader
    {
      INT     pathID;
      INT     parentID;
      INT     flags;
    };

    struct HierarchyPath : HierarchyHeader
    {
      PTSTR   name;
    };

    struct HierarchyItem
    {
      Data::ResourceType type;

      INT     resourceID;
      INT     pathID;
    };

    class Hierarchy
    {
    private:
      Generic::Vector<HierarchyPath*, 10>  mPaths;
      Generic::Vector<HierarchyItem*, 10>  mItems;

    public:
      INL const Generic::Vector<HierarchyPath*, 10>& getPaths()
      {
        return mPaths;
      }

      INL const Generic::Vector<HierarchyItem*, 10>& getItems()
      {
        return mItems;
      }

      VOID    close();
      BOOL    load(PCTSTR iFilename);
      BOOL    save(PCTSTR iFilename);

      HierarchyPath*  addPath(
        PCTSTR iName,
        INT iParentID
        );
      VOID  removePath(
        INT iPathID
        );

      VOID  setItemPath(
        INT iResourceID,
        INT iPathID,
        Data::ResourceType iType
        );
      VOID  unsetItemPath(
        INT iResourceID,
        Data::ResourceType iType
        );
      const HierarchyPath*  getItemPath(
        INT iResourceID,
        Data::ResourceType iType
        );

      Hierarchy();
      ~Hierarchy();
    };
  } // namespace Creator
} // namespace Retro

#endif
